/*
 * @Author: 吕佳伟
 * @Date: 2021-03-30 11:54:11
 * @LastEditors: 吕佳伟
 * @LastEditTime: 2021-07-03 21:38:00
 * @Description: file content
 */
import 'package:flutter/material.dart';

import '../models/ClassItemViewModel.dart';

///课程数据项构造
///吕佳伟
class ClassItem extends StatelessWidget {
  final ClassItemViewModel data;

  const ClassItem({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return FlatButton(
        onPressed: () => Navigator.pushNamed(context, "class_in",
            arguments: this.data.ClassId),
        child: new Container(
          height: 140,
          margin: EdgeInsets.fromLTRB(16, 16, 16, 0),
          padding: EdgeInsets.only(left: 20, top: 10),
          decoration: BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.topLeft,
              end: Alignment.bottomRight,
              colors: this.data.itemColors,
            ),
            borderRadius: BorderRadius.circular(8),
            boxShadow: [
              BoxShadow(
                blurRadius: 6,
                spreadRadius: 4,
                color: Color.fromARGB(20, 0, 0, 0),
              ),
            ],
          ),
          child: Stack(
            children: <Widget>[
              Positioned(
                left: 0,
                top: 0,
                right: 0,
                bottom: 0,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Row(
                      children: <Widget>[
                        Padding(padding: EdgeInsets.only(left: 15)),
                        Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: <Widget>[
                            Text(
                              this.data.lessonName,
                              style: TextStyle(
                                fontSize: 19,
                                fontWeight: FontWeight.bold,
                                color: Colors.white,
                              ),
                            ),
                            Text(
                              this.data.teacherName,
                              style: TextStyle(
                                fontSize: 16,
                                color: Color.fromARGB(200, 255, 255, 255),
                              ),
                            ),
                          ],
                        )
                      ],
                    ),
                    Padding(
                      padding: EdgeInsets.only(left: 15, top: 10),
                      child: Text(
                        this.data.campus + this.data.classPlace,
                        style: TextStyle(
                          fontSize: 18,
                          fontFamily: 'Farrington',
                          color: Colors.white,
                        ),
                      ),
                    ),
                    Padding(
                      padding: EdgeInsets.only(left: 15, top: 10),
                      child: Text(
                        this.data.classTime,
                        style: TextStyle(
                          fontSize: 16,
                          color: Colors.white,
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ));
  }
}
